<?php
/**
 * ContactForm Class
 */
 
/**
 * ContactForm class.
 *
 * ContactForm is the data structure for keeping
 * contact form data. It is used by the 'contact' action of 'SiteController'.
 *
 * @package Models
 */
class ContactForm extends CFormModel
{
	/**
	 * @var string value of 'name' field
	 */
	public $name;
	
	/**
	 * @var string value of 'email' field
	 */
	public $email;
	
	/**
	 * @var string value of 'subject' field
	 */
	public $subject;
	
	/**
	 * @var string value of 'body' field
	 */
	public $body;
	
	/**
	 * @var string value of 'verifyCode' field
	 */
	public $verifyCode;

	/**
	 * Declares the validation rules.
	 *
	 * @return array rules to apply to form fields at validation
	 */
	public function rules()
	{
		return array(
			// name, email, subject and body are required
			array('name, email, subject, body', 'required'),
			// email has to be a valid email address
			array('email', 'email'),
			// verifyCode needs to be entered correctly
			array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
		);
	}

	/**
	 * Declares customized attribute labels.
	 *
	 * If not declared here, an attribute would have a label that is
	 * the same as its name with the first letter in upper case.
	 *
	 * @return array labels for form fields
	 */
	public function attributeLabels()
	{
		return array(
			'verifyCode'=>'Codigo de Verificacion',
		);
	}
}